

(function( $ ){
    $(function() {
        var locat = common_url;
        $(".filePicker").each(function(i){
    		var target = $(this).attr("id");
	        uploader = WebUploader.create({
	            pick: {
	                id: '#'+target,
	                label: '点击选择图片'
	            },
	            auto: true,
	            swf: './Uploader.swf',
	            chunked: false,
	            server: locat+'/picture/upload',
	            accept: {
	                 title: 'Images',
	                 extensions: 'gif,jpg,jpeg,bmp,png',
	                 mimeTypes: 'image/jpg,image/jpeg,image/png,image/gif,image/bmp'
	             },
	            disableGlobalDnd: true,
	            fileNumLimit: 100
	        });
	        uploader.on( 'uploadAccept', function( object ,ret  ) {
	        	if(ret){
	        		$("input[name='"+target+"']").val(ret.url);
	        	}
	        });
	        uploader.on( 'uploadSuccess', function( file) {
	        	debugger;
	        	if(file){
	        		 uploader.makeThumb( file, function( error, src ) {
	     	        	 img = $('<img src="'+src+'">');
	     	        	$("#"+target+"_list").empty().append(img);
	                 });
	        	}
	        });
	        
    	});
    });
})( jQuery );